Setting GWeatherInfo:location to null helpfully doesn't mean
"no location", but "NYC". This obviously isn't what we want
to show users, so track the location validity separately and
consider it when updating the label shown to users.
https://bugzilla.gnome.org/show_bug.cgi?id=780252
_init: function() {
this._loading = false;
+ this._locationValid = false;
this._lastUpdate = GLib.DateTime.new_from_unix_local(0);
this._useAutoLocation = false;
return this._loading;
},
+ get hasLocation() {
+ return this._locationValid;
+ },
+
get info() {
return this._weatherInfo;
},
},
update: function() {
+ if (!this._locationValid)
+ return;
+
let now = GLib.DateTime.new_now_local();
// Update without loading indication if the current info is recent enough
if (this._weatherInfo.is_valid() &&
this._weatherInfo.abort();
this._weatherInfo.set_location(location);
+ this._locationValid = (location != null);
if (location)
this._loadInfo();
},
_getLabelText: function() {
+ if (!this._weatherClient.hasLocation)
+ return _("Select a location…");
+
if (this._weatherClient.loading)
return _("Loading…");